<!DOCTYPE html><html><head><title>Ext.util.Format | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
<style type="text/css">.head-band { display: none; }
.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
.doc-tab .members .member a.more { background-color: #efefef; }
</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">

    req = {
        liveURL: '.',
        standAloneMode: true,
        origDocClass: 'Ext.util.Format',
        docClass: 'Ext.util.Format',
        docReq: 'Ext.util.Format',
        version: '4.0',
        baseURL: '.',
        baseDocURL: '.',
        baseProdURL: '.'
    };

    clsInfo = {};



</script>

<script type="text/javascript" src="../search.js"></script>
<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
<script type="text/javascript" src="../class_tree.js"></script>
<script type="text/javascript" src="../class_doc.js"></script>
<script type="text/javascript">
    req.source = 'Format.html#Ext-util.Format';
    clsInfo = {"methods":["currency","date","dateRenderer","defaultValue","escapeRegex","fileSize","lowercase","math","nl2br","number","numberRenderer","parseBox","plural","round","stripScripts","stripTags","substr","undef","uppercase","usMoney"],"cfgs":[],"properties":["capitalize","currencyAtEnd","currencyPrecision","currencySign","decimalSeparator","ellipsis","format","htmlDecode","htmlEncode","leftPad","thousandSeparator","trim"],"events":[],"subclasses":[]};
    Ext.onReady(function() {
        Ext.create('Docs.classPanel');
    });
</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Format.html#Ext-util.Format" target="_blank">Ext.util.Format</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>This class is a centralized place for formatting functions inside the library. It includes
functions to format various different types of data, such as text, dates and numeric values.</p>

<p><strong>Localization</strong>
This class contains several options for localization. These can be set once the library has loaded,
all calls to the functions from that point will use the locale settings that were specified.
Options include:
- thousandSeparator
- decimalSeparator
- currenyPrecision
- currencySign
- currencyAtEnd
This class also uses the default date format defined here: <a href="Ext.date.html#defaultFormat" rel="Ext.date#defaultFormat" class="docClass">Ext.date.defaultFormat</a>.</p>

<p><strong>Using with renderers</strong>
There are two helper functions that return a new function that can be used in conjunction with
grid renderers:</p>

<pre class="prettyprint"><code>columns: [{
    dataIndex: 'date',
    renderer: Ext.util.Format.dateRenderer('Y-m-d')
}, {
    dataIndex: 'time',
    renderer: Ext.util.Format.numberRenderer('0.000')
}]
</code></pre>

<p>Functions that only take a single argument can also be passed directly:</p>

<pre class="prettyprint"><code>columns: [{
    dataIndex: 'cost',
    renderer: Ext.util.Format.usMoney
}, {
    dataIndex: 'productCode',
    renderer: Ext.util.Format.uppercase
}]
</code></pre>

<p><strong>Using with XTemplates</strong>
XTemplates can also directly use <a href="Ext.util.Format.html" rel="Ext.util.Format" class="docClass">Ext.util.Format</a> functions:</p>

<pre class="prettyprint"><code>new Ext.XTemplate([
    'Date: {startDate:date("Y-m-d")}',
    'Cost: {cost:usMoney}'
]);
</code></pre>
<div class="members"><div class="m-properties"><a name="properties"></a><div class="definedBy">Defined By</div><h3 class="prp p">Properties</h3><div id="property-capitalize" class="member f ni"><a href="Ext.util.Format.html#property-capitalize" rel="property-capitalize" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-capitalize" class="viewSource">view source</a></div><a name="capitalize"></a><a name="property-capitalize"></a><a href="Ext.util.Format.html#" rel="property-capitalize" class="cls expand">capitalize</a><span> : Object</span></div><div class="description"><div class="short"><p>Capitalize the given string. See <a href="Ext.String.html#capitalize" rel="Ext.String#capitalize" class="docClass">Ext.String.capitalize</a>.</p>
</div><div class="long"><p>Capitalize the given string. See <a href="Ext.String.html#capitalize" rel="Ext.String#capitalize" class="docClass">Ext.String.capitalize</a>.</p>
</div></div></div><div id="property-currencyAtEnd" class="member ni"><a href="Ext.util.Format.html#property-currencyAtEnd" rel="property-currencyAtEnd" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-currencyAtEnd" class="viewSource">view source</a></div><a name="currencyAtEnd"></a><a name="property-currencyAtEnd"></a><a href="Ext.util.Format.html#" rel="property-currencyAtEnd" class="cls expand">currencyAtEnd</a><span> : Boolean</span></div><div class="description"><div class="short">This may be set to true to make the currency function
append the currency sign to the formatted value.


This default...</div><div class="long"><p>This may be set to <code>true</code> to make the <a href="Ext.util.Format.html#currency" rel="Ext.util.Format#currency" class="docClass">currency</a> function
append the currency sign to the formatted value.</p>


<p>This defaults to <code>false</code>, but may be overridden in a locale file.</p>

</div></div></div><div id="property-currencyPrecision" class="member ni"><a href="Ext.util.Format.html#property-currencyPrecision" rel="property-currencyPrecision" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-currencyPrecision" class="viewSource">view source</a></div><a name="currencyPrecision"></a><a name="property-currencyPrecision"></a><a href="Ext.util.Format.html#" rel="property-currencyPrecision" class="cls expand">currencyPrecision</a><span> : Number</span></div><div class="description"><div class="short">The number of decimal places that the currency function displays.


This defaults to 2, but may be overridden in a lo...</div><div class="long"><p>The number of decimal places that the <a href="Ext.util.Format.html#currency" rel="Ext.util.Format#currency" class="docClass">currency</a> function displays.</p>


<p>This defaults to <code>2</code>, but may be overridden in a locale file.</p>

</div></div></div><div id="property-currencySign" class="member ni"><a href="Ext.util.Format.html#property-currencySign" rel="property-currencySign" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-currencySign" class="viewSource">view source</a></div><a name="currencySign"></a><a name="property-currencySign"></a><a href="Ext.util.Format.html#" rel="property-currencySign" class="cls expand">currencySign</a><span> : String</span></div><div class="description"><div class="short"><p>The currency sign that the <a href="Ext.util.Format.html#currency" rel="Ext.util.Format#currency" class="docClass">currency</a> function displays.</p>


<p>This defaults to <code>$</code>, but may be overridden in a locale file.</p>

</div><div class="long"><p>The currency sign that the <a href="Ext.util.Format.html#currency" rel="Ext.util.Format#currency" class="docClass">currency</a> function displays.</p>


<p>This defaults to <code>$</code>, but may be overridden in a locale file.</p>

</div></div></div><div id="property-decimalSeparator" class="member ni"><a href="Ext.util.Format.html#property-decimalSeparator" rel="property-decimalSeparator" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-decimalSeparator" class="viewSource">view source</a></div><a name="decimalSeparator"></a><a name="property-decimalSeparator"></a><a href="Ext.util.Format.html#" rel="property-decimalSeparator" class="cls expand">decimalSeparator</a><span> : String</span></div><div class="description"><div class="short">The character that the number function uses as a decimal point.


This defaults to ., but may be overridden in a loca...</div><div class="long"><p>The character that the <a href="Ext.util.Format.html#number" rel="Ext.util.Format#number" class="docClass">number</a> function uses as a decimal point.</p>


<p>This defaults to <code>.</code>, but may be overridden in a locale file.</p>

</div></div></div><div id="property-ellipsis" class="member ni"><a href="Ext.util.Format.html#property-ellipsis" rel="property-ellipsis" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-ellipsis" class="viewSource">view source</a></div><a name="ellipsis"></a><a name="property-ellipsis"></a><a href="Ext.util.Format.html#" rel="property-ellipsis" class="cls expand">ellipsis</a><span> : Object</span></div><div class="description"><div class="short"><p>Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length.
See <a href="Ext.String.html#ellipsis" rel="Ext.String#ellipsis" class="docClass">Ext.String.ellipsis</a>.</p>
</div><div class="long"><p>Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length.
See <a href="Ext.String.html#ellipsis" rel="Ext.String#ellipsis" class="docClass">Ext.String.ellipsis</a>.</p>
</div></div></div><div id="property-format" class="member ni"><a href="Ext.util.Format.html#property-format" rel="property-format" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-format" class="viewSource">view source</a></div><a name="format"></a><a name="property-format"></a><a href="Ext.util.Format.html#" rel="property-format" class="cls expand">format</a><span> : Object</span></div><div class="description"><div class="short"><p>Formats to a string. See <a href="Ext.String.html#format" rel="Ext.String#format" class="docClass">Ext.String.format</a></p>
</div><div class="long"><p>Formats to a string. See <a href="Ext.String.html#format" rel="Ext.String#format" class="docClass">Ext.String.format</a></p>
</div></div></div><div id="property-htmlDecode" class="member ni"><a href="Ext.util.Format.html#property-htmlDecode" rel="property-htmlDecode" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-htmlDecode" class="viewSource">view source</a></div><a name="htmlDecode"></a><a name="property-htmlDecode"></a><a href="Ext.util.Format.html#" rel="property-htmlDecode" class="cls expand">htmlDecode</a><span> : Object</span></div><div class="description"><div class="short"><p>Convert certain characters (&amp;, &lt;, >, and ') from their HTML character equivalents.
See <a href="Ext.string.html#htmlDecode" rel="Ext.string#htmlDecode" class="docClass">Ext.string.htmlDecode</a>.</p>
</div><div class="long"><p>Convert certain characters (&amp;, &lt;, >, and ') from their HTML character equivalents.
See <a href="Ext.string.html#htmlDecode" rel="Ext.string#htmlDecode" class="docClass">Ext.string.htmlDecode</a>.</p>
</div></div></div><div id="property-htmlEncode" class="member ni"><a href="Ext.util.Format.html#property-htmlEncode" rel="property-htmlEncode" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-htmlEncode" class="viewSource">view source</a></div><a name="htmlEncode"></a><a name="property-htmlEncode"></a><a href="Ext.util.Format.html#" rel="property-htmlEncode" class="cls expand">htmlEncode</a><span> : Object</span></div><div class="description"><div class="short">Convert certain characters (&amp;, &lt;, >, and ') to their HTML character equivalents for literal display in web pag...</div><div class="long"><p>Convert certain characters (&amp;, &lt;, >, and ') to their HTML character equivalents for literal display in web pages.
See <a href="Ext.String.html#htmlEncode" rel="Ext.String#htmlEncode" class="docClass">Ext.String.htmlEncode</a>.</p>
</div></div></div><div id="property-leftPad" class="member ni"><a href="Ext.util.Format.html#property-leftPad" rel="property-leftPad" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-leftPad" class="viewSource">view source</a></div><a name="leftPad"></a><a name="property-leftPad"></a><a href="Ext.util.Format.html#" rel="property-leftPad" class="cls expand">leftPad</a><span> : Object</span></div><div class="description"><div class="short"><p>Adds left padding to a string. See <a href="Ext.String.html#leftPad" rel="Ext.String#leftPad" class="docClass">Ext.String.leftPad</a></p>
</div><div class="long"><p>Adds left padding to a string. See <a href="Ext.String.html#leftPad" rel="Ext.String#leftPad" class="docClass">Ext.String.leftPad</a></p>
</div></div></div><div id="property-thousandSeparator" class="member ni"><a href="Ext.util.Format.html#property-thousandSeparator" rel="property-thousandSeparator" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-thousandSeparator" class="viewSource">view source</a></div><a name="thousandSeparator"></a><a name="property-thousandSeparator"></a><a href="Ext.util.Format.html#" rel="property-thousandSeparator" class="cls expand">thousandSeparator</a><span> : String</span></div><div class="description"><div class="short">The character that the number function uses as a thousand separator.


This defaults to ,, but may be overridden in a...</div><div class="long"><p>The character that the <a href="Ext.util.Format.html#number" rel="Ext.util.Format#number" class="docClass">number</a> function uses as a thousand separator.</p>


<p>This defaults to <code>,</code>, but may be overridden in a locale file.</p>

</div></div></div><div id="property-trim" class="member ni"><a href="Ext.util.Format.html#property-trim" rel="property-trim" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-property-trim" class="viewSource">view source</a></div><a name="trim"></a><a name="property-trim"></a><a href="Ext.util.Format.html#" rel="property-trim" class="cls expand">trim</a><span> : Object</span></div><div class="description"><div class="short"><p>Trims any whitespace from either side of a string. See <a href="Ext.String.html#trim" rel="Ext.String#trim" class="docClass">Ext.String.trim</a>.</p>
</div><div class="long"><p>Trims any whitespace from either side of a string. See <a href="Ext.String.html#trim" rel="Ext.String#trim" class="docClass">Ext.String.trim</a>.</p>
</div></div></div></div><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-currency" class="member f ni"><a href="Ext.util.Format.html#method-currency" rel="method-currency" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-currency" class="viewSource">view source</a></div><a name="currency"></a><a name="method-currency"></a><a href="Ext.util.Format.html#" rel="method-currency" class="cls expand">currency</a>(
<span class="pre">Number/String value, String sign, Number decimals, Boolean end</span>)
 : String</div><div class="description"><div class="short"><p>Format a number as a currency</p>
</div><div class="long"><p>Format a number as a currency</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Number/String<div class="sub-desc"><p>The numeric value to format</p>
</div></li><li><span class="pre">sign</span> : String<div class="sub-desc"><p>The currency sign to use (defaults to <a href="Ext.util.Format.html#currencySign" rel="Ext.util.Format#currencySign" class="docClass">currencySign</a>)</p>
</div></li><li><span class="pre">decimals</span> : Number<div class="sub-desc"><p>The number of decimals to use for the currency (defaults to <a href="Ext.util.Format.html#currencyPrecision" rel="Ext.util.Format#currencyPrecision" class="docClass">currencyPrecision</a>)</p>
</div></li><li><span class="pre">end</span> : Boolean<div class="sub-desc"><p>True if the currency sign should be at the end of the string (defaults to <a href="Ext.util.Format.html#currencyAtEnd" rel="Ext.util.Format#currencyAtEnd" class="docClass">currencyAtEnd</a>)</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The formatted currency string</p>
</li></ul></div></div></div><div id="method-date" class="member ni"><a href="Ext.util.Format.html#method-date" rel="method-date" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-date" class="viewSource">view source</a></div><a name="date"></a><a name="method-date"></a><a href="Ext.util.Format.html#" rel="method-date" class="cls expand">date</a>(
<span class="pre">String/Date value, String format</span>)
 : String</div><div class="description"><div class="short"><p>Formats the passed date using the specified format pattern.</p>
</div><div class="long"><p>Formats the passed date using the specified format pattern.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : String/Date<div class="sub-desc"><p>The value to format. If a string is passed, it is converted to a Date by the Javascript
Date object's <a href="http://www.w3schools.com/jsref/jsref_parse.asp">parse()</a> method.</p>
</div></li><li><span class="pre">format</span> : String<div class="sub-desc"><p>(Optional) Any valid date format string. Defaults to <a href="Ext.Date.html#defaultFormat" rel="Ext.Date#defaultFormat" class="docClass">Ext.Date.defaultFormat</a>.</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The formatted date string.</p>
</li></ul></div></div></div><div id="method-dateRenderer" class="member ni"><a href="Ext.util.Format.html#method-dateRenderer" rel="method-dateRenderer" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-dateRenderer" class="viewSource">view source</a></div><a name="dateRenderer"></a><a name="method-dateRenderer"></a><a href="Ext.util.Format.html#" rel="method-dateRenderer" class="cls expand">dateRenderer</a>(
<span class="pre">String format</span>)
 : Function</div><div class="description"><div class="short"><p>Returns a date rendering function that can be reused to apply a date format multiple times efficiently</p>
</div><div class="long"><p>Returns a date rendering function that can be reused to apply a date format multiple times efficiently</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">format</span> : String<div class="sub-desc"><p>Any valid date format string. Defaults to <a href="Ext.Date.html#defaultFormat" rel="Ext.Date#defaultFormat" class="docClass">Ext.Date.defaultFormat</a>.</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Function</span>&nbsp; &nbsp;<p>The date formatting function</p>
</li></ul></div></div></div><div id="method-defaultValue" class="member ni"><a href="Ext.util.Format.html#method-defaultValue" rel="method-defaultValue" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-defaultValue" class="viewSource">view source</a></div><a name="defaultValue"></a><a name="method-defaultValue"></a><a href="Ext.util.Format.html#" rel="method-defaultValue" class="cls expand">defaultValue</a>(
<span class="pre">Mixed value, String defaultValue</span>)
 : String</div><div class="description"><div class="short"><p>Checks a reference and converts it to the default value if it's empty</p>
</div><div class="long"><p>Checks a reference and converts it to the default value if it's empty</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Mixed<div class="sub-desc"><p>Reference to check</p>
</div></li><li><span class="pre">defaultValue</span> : String<div class="sub-desc"><p>The value to insert of it's undefined (defaults to "")</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-escapeRegex" class="member ni"><a href="Ext.util.Format.html#method-escapeRegex" rel="method-escapeRegex" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-escapeRegex" class="viewSource">view source</a></div><a name="escapeRegex"></a><a name="method-escapeRegex"></a><a href="Ext.util.Format.html#" rel="method-escapeRegex" class="cls expand">escapeRegex</a>(
<span class="pre">String str</span>)
 : String</div><div class="description"><div class="short"><p>Escapes the passed string for use in a regular expression</p>
</div><div class="long"><p>Escapes the passed string for use in a regular expression</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">str</span> : String<div class="sub-desc">
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-fileSize" class="member ni"><a href="Ext.util.Format.html#method-fileSize" rel="method-fileSize" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-fileSize" class="viewSource">view source</a></div><a name="fileSize"></a><a name="method-fileSize"></a><a href="Ext.util.Format.html#" rel="method-fileSize" class="cls expand">fileSize</a>(
<span class="pre">Number/String size</span>)
 : String</div><div class="description"><div class="short"><p>Simple format for a file size (xxx bytes, xxx KB, xxx MB)</p>
</div><div class="long"><p>Simple format for a file size (xxx bytes, xxx KB, xxx MB)</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">size</span> : Number/String<div class="sub-desc"><p>The numeric value to format</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The formatted file size</p>
</li></ul></div></div></div><div id="method-lowercase" class="member ni"><a href="Ext.util.Format.html#method-lowercase" rel="method-lowercase" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-lowercase" class="viewSource">view source</a></div><a name="lowercase"></a><a name="method-lowercase"></a><a href="Ext.util.Format.html#" rel="method-lowercase" class="cls expand">lowercase</a>(
<span class="pre">String value</span>)
 : String</div><div class="description"><div class="short"><p>Converts a string to all lower case letters</p>
</div><div class="long"><p>Converts a string to all lower case letters</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : String<div class="sub-desc"><p>The text to convert</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The converted text</p>
</li></ul></div></div></div><div id="method-math" class="member ni"><a href="Ext.util.Format.html#method-math" rel="method-math" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-math" class="viewSource">view source</a></div><a name="math"></a><a name="method-math"></a><a href="Ext.util.Format.html#" rel="method-math" class="cls expand">math</a> : Function</div><div class="description"><div class="short">It does simple math for use in a template, for example:

var tpl = new Ext.Template('{value} * 10 = {value:math("* 10...</div><div class="long"><p>It does simple math for use in a template, for example:</p>

<pre><code>var tpl = new Ext.Template('{value} * 10 = {value:math("* 10")}');
</code></pre>

<h3 class="pa">Returns</h3><ul><li><span class="pre">Function</span>&nbsp; &nbsp;<p>A function that operates on the passed value.</p>
</li></ul></div></div></div><div id="method-nl2br" class="member ni"><a href="Ext.util.Format.html#method-nl2br" rel="method-nl2br" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-nl2br" class="viewSource">view source</a></div><a name="nl2br"></a><a name="method-nl2br"></a><a href="Ext.util.Format.html#" rel="method-nl2br" class="cls expand">nl2br</a>(
<span class="pre">String The</span>)
 : String</div><div class="description"><div class="short"><p>Converts newline characters to the HTML tag &lt;br/></p>
</div><div class="long"><p>Converts newline characters to the HTML tag &lt;br/></p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">The</span> : String<div class="sub-desc"><p>string value to format.</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The string with embedded &lt;br/> tags in place of newlines.</p>
</li></ul></div></div></div><div id="method-number" class="member ni"><a href="Ext.util.Format.html#method-number" rel="method-number" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-number" class="viewSource">view source</a></div><a name="number"></a><a name="method-number"></a><a href="Ext.util.Format.html#" rel="method-number" class="cls expand">number</a>(
<span class="pre">Number v, String format</span>)
 : String</div><div class="description"><div class="short">Formats the passed number according to the passed format string.


The number of digits after the decimal separator c...</div><div class="long"><p>Formats the passed number according to the passed format string.</p>


<p>The number of digits after the decimal separator character specifies the number of
decimal places in the resulting string. The <u>local-specific</u> decimal character is used in the result.</p>


<p>The <i>presence</i> of a thousand separator character in the format string specifies that
the <u>locale-specific</u> thousand separator (if any) is inserted separating thousand groups.</p>


<p>By default, "," is expected as the thousand separator, and "." is expected as the decimal separator.</p>


<p><b>New to Ext4</b></p>


<p>Locale-specific characters are always used in the formatted output when inserting
thousand and decimal separators.</p>


<p>The format string must specify separator characters according to US/UK conventions ("," as the
thousand separator, and "." as the decimal separator)</p>


<p>To allow specification of format strings according to local conventions for separator characters, add
the string <code>/i</code> to the end of the format string.</p>


<div style="margin-left:40px">examples (123456.789):
<div style="margin-left:10px">
0 - (123456) show only digits, no precision<br>
0.00 - (123456.78) show only digits, 2 precision<br>
0.0000 - (123456.7890) show only digits, 4 precision<br>
0,000 - (123,456) show comma and digits, no precision<br>
0,000.00 - (123,456.78) show comma and digits, 2 precision<br>
0,0.00 - (123,456.78) shortcut method, show comma and digits, 2 precision<br>
To allow specification of the formatting string using UK/US grouping characters (,) and decimal (.) for international numbers, add /i to the end.
For example: 0.000,00/i
</div></div>

<h3 class="pa">Parameters</h3><ul><li><span class="pre">v</span> : Number<div class="sub-desc"><p>The number to format.</p>
</div></li><li><span class="pre">format</span> : String<div class="sub-desc"><p>The way you would like to format this text.</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The formatted number.</p>
</li></ul></div></div></div><div id="method-numberRenderer" class="member ni"><a href="Ext.util.Format.html#method-numberRenderer" rel="method-numberRenderer" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-numberRenderer" class="viewSource">view source</a></div><a name="numberRenderer"></a><a name="method-numberRenderer"></a><a href="Ext.util.Format.html#" rel="method-numberRenderer" class="cls expand">numberRenderer</a>(
<span class="pre">String format</span>)
 : Function</div><div class="description"><div class="short"><p>Returns a number rendering function that can be reused to apply a number format multiple times efficiently</p>
</div><div class="long"><p>Returns a number rendering function that can be reused to apply a number format multiple times efficiently</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">format</span> : String<div class="sub-desc"><p>Any valid number format string for <a href="Ext.util.Format.html#number" rel="Ext.util.Format#number" class="docClass">number</a></p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Function</span>&nbsp; &nbsp;<p>The number formatting function</p>
</li></ul></div></div></div><div id="method-parseBox" class="member ni"><a href="Ext.util.Format.html#method-parseBox" rel="method-parseBox" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-parseBox" class="viewSource">view source</a></div><a name="parseBox"></a><a name="method-parseBox"></a><a href="Ext.util.Format.html#" rel="method-parseBox" class="cls expand">parseBox</a>(
<span class="pre">Number|String v</span>)
 : Object</div><div class="description"><div class="short">Parses a number or string representing margin sizes into an object. Supports CSS-style margin declarations
(e.g. 10, ...</div><div class="long"><p>Parses a number or string representing margin sizes into an object. Supports CSS-style margin declarations
(e.g. 10, "10", "10 10", "10 10 10" and "10 10 10 10" are all valid options and would return the same result)</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">v</span> : Number|String<div class="sub-desc"><p>The encoded margins</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span>&nbsp; &nbsp;<p>An object with margin sizes for top, right, bottom and left</p>
</li></ul></div></div></div><div id="method-plural" class="member ni"><a href="Ext.util.Format.html#method-plural" rel="method-plural" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-plural" class="viewSource">view source</a></div><a name="plural"></a><a name="method-plural"></a><a href="Ext.util.Format.html#" rel="method-plural" class="cls expand">plural</a>(
<span class="pre">Number value, String singular, [String plural]</span>)
 : void</div><div class="description"><div class="short">Selectively do a plural form of a word based on a numeric value. For example, in a template,
{commentCount:plural("Co...</div><div class="long"><p>Selectively do a plural form of a word based on a numeric value. For example, in a template,
{commentCount:plural("Comment")}  would result in "1 Comment" if commentCount was 1 or would be "x Comments"
if the value is 0 or greater than 1.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Number<div class="sub-desc"><p>The value to compare against</p>
</div></li><li><span class="pre">singular</span> : String<div class="sub-desc"><p>The singular form of the word</p>
</div></li><li><span class="pre">plural</span> : String<div class="sub-desc"><p>(optional) The plural form of the word (defaults to the singular with an "s")</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-round" class="member ni"><a href="Ext.util.Format.html#method-round" rel="method-round" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-round" class="viewSource">view source</a></div><a name="round"></a><a name="method-round"></a><a href="Ext.util.Format.html#" rel="method-round" class="cls expand">round</a>(
<span class="pre">Number/String value, Number precision</span>)
 : Number</div><div class="description"><div class="short"><p>Rounds the passed number to the required decimal precision.</p>
</div><div class="long"><p>Rounds the passed number to the required decimal precision.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Number/String<div class="sub-desc"><p>The numeric value to round.</p>
</div></li><li><span class="pre">precision</span> : Number<div class="sub-desc"><p>The number of decimal places to which to round the first parameter's value.</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>The rounded value.</p>
</li></ul></div></div></div><div id="method-stripScripts" class="member ni"><a href="Ext.util.Format.html#method-stripScripts" rel="method-stripScripts" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-stripScripts" class="viewSource">view source</a></div><a name="stripScripts"></a><a name="method-stripScripts"></a><a href="Ext.util.Format.html#" rel="method-stripScripts" class="cls expand">stripScripts</a>(
<span class="pre">Mixed value</span>)
 : String</div><div class="description"><div class="short"><p>Strips all script tags</p>
</div><div class="long"><p>Strips all script tags</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Mixed<div class="sub-desc"><p>The text from which to strip script tags</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The stripped text</p>
</li></ul></div></div></div><div id="method-stripTags" class="member ni"><a href="Ext.util.Format.html#method-stripTags" rel="method-stripTags" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-stripTags" class="viewSource">view source</a></div><a name="stripTags"></a><a name="method-stripTags"></a><a href="Ext.util.Format.html#" rel="method-stripTags" class="cls expand">stripTags</a>(
<span class="pre">Mixed value</span>)
 : String</div><div class="description"><div class="short"><p>Strips all HTML tags</p>
</div><div class="long"><p>Strips all HTML tags</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Mixed<div class="sub-desc"><p>The text from which to strip tags</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The stripped text</p>
</li></ul></div></div></div><div id="method-substr" class="member ni"><a href="Ext.util.Format.html#method-substr" rel="method-substr" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-substr" class="viewSource">view source</a></div><a name="substr"></a><a name="method-substr"></a><a href="Ext.util.Format.html#" rel="method-substr" class="cls expand">substr</a>(
<span class="pre">String value, Number start, Number length</span>)
 : String</div><div class="description"><div class="short"><p>Returns a substring from within an original string</p>
</div><div class="long"><p>Returns a substring from within an original string</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : String<div class="sub-desc"><p>The original text</p>
</div></li><li><span class="pre">start</span> : Number<div class="sub-desc"><p>The start index of the substring</p>
</div></li><li><span class="pre">length</span> : Number<div class="sub-desc"><p>The length of the substring</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The substring</p>
</li></ul></div></div></div><div id="method-undef" class="member ni"><a href="Ext.util.Format.html#method-undef" rel="method-undef" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-undef" class="viewSource">view source</a></div><a name="undef"></a><a name="method-undef"></a><a href="Ext.util.Format.html#" rel="method-undef" class="cls expand">undef</a>(
<span class="pre">Mixed value</span>)
 : Mixed</div><div class="description"><div class="short"><p>Checks a reference and converts it to empty string if it is undefined</p>
</div><div class="long"><p>Checks a reference and converts it to empty string if it is undefined</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Mixed<div class="sub-desc"><p>Reference to check</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Mixed</span>&nbsp; &nbsp;<p>Empty string if converted, otherwise the original value</p>
</li></ul></div></div></div><div id="method-uppercase" class="member ni"><a href="Ext.util.Format.html#method-uppercase" rel="method-uppercase" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-uppercase" class="viewSource">view source</a></div><a name="uppercase"></a><a name="method-uppercase"></a><a href="Ext.util.Format.html#" rel="method-uppercase" class="cls expand">uppercase</a>(
<span class="pre">String value</span>)
 : String</div><div class="description"><div class="short"><p>Converts a string to all upper case letters</p>
</div><div class="long"><p>Converts a string to all upper case letters</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : String<div class="sub-desc"><p>The text to convert</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The converted text</p>
</li></ul></div></div></div><div id="method-usMoney" class="member ni"><a href="Ext.util.Format.html#method-usMoney" rel="method-usMoney" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Format.html" class="definedIn docClass">Ext.util.Format</a><br/><a href="../source/Format.html#Ext-util.Format-method-usMoney" class="viewSource">view source</a></div><a name="usMoney"></a><a name="method-usMoney"></a><a href="Ext.util.Format.html#" rel="method-usMoney" class="cls expand">usMoney</a>(
<span class="pre">Number/String value</span>)
 : String</div><div class="description"><div class="short"><p>Format a number as US currency</p>
</div><div class="long"><p>Format a number as US currency</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Number/String<div class="sub-desc"><p>The numeric value to format</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The formatted currency string</p>
</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>